package com.hgx.web.service.restful.server;


import com.hgx.web.service.restful.bean.Student;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.sql.Date;
import java.time.Instant;

@Path("/rest")
public class StudentServer {


    @Path("/student/{id}")
    @GET
//    @Produces("application/json")
    @Produces(MediaType.APPLICATION_JSON)
    public Student getStudentById(@PathParam("id") String id) {
        return new Student(6666, "韩哈哈哈", 20, Date.from(Instant.now()));
    }



    @Path("/student")
    @POST
    @Consumes("application/x-www-form-urlencoded")
    public String Student(@BeanParam Student student){

        System.out.println(student);

        return "success:"+student.toString();

    }

}
